package com.learn.mapstruct.mapper;

import com.learn.mapstruct.entity.Cat;
import com.learn.mapstruct.entity.Person;
import com.learn.mapstruct.kit.ConvertKit1;
import com.learn.mapstruct.kit.ConvertKit2;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author huangChao
 **/
@Mapper(uses = {ConvertKit1.class, ConvertKit2.class})
public interface CatMapper {
	CatMapper INSTANCE = Mappers.getMapper(CatMapper.class);

	@Mapping(target = "name", source = "firstName")
	@Mapping(target = "notes", source = "lastName")
	@Mapping(target = "paramsStr", source = "params", qualifiedByName = {"ConvertKit1", "listToStrAlias"})
	@Mapping(source = "car", target = "sourceJson", qualifiedByName = {"toJson", "ConvertKit2"})
	@Mapping(target = "params2", source = "params2", qualifiedByName = {"ConvertKit1", "toJson"})
	Cat convert(Person car);
}
